<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" exclude-result-prefixes="x d cmswrt xsl msxsl" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:cmswrt="http://schemas.microsoft.com/WebPart/v3/Publishing/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">

  <xsl:output method="html" indent="no" />

  <!--
	Following Nodes and Attributes are delivered by the conrol

	<MenuItems CurrentKey="[/someUrl]" CurrentLevel="[Number - starts with 0]" Level="[Number - starts with 0]" ParentKey="[/someUrl]">
		<MenuItem ImageUrl="[/someUrl]" Url="[/someUrl]" Target="[|new|_blank]" Title="[someText]" ToolTip="[someText]" Level="[Number - starts with 0]" Selected="[True|False]" Key="[/someUrl]" ParentKey="[/someUrl]">
			<MenuItems>
				<MenuItem ...="">
					...
				</MenuItem>
			</MenuItems>
		</MenuItem>
	</MenuItems>
	-->

  <xsl:variable name="Upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
  <xsl:variable name="Lower" select="'abcdefghijklmnopqrstuvwxyz'"/>

  <xsl:variable name="CurrentLevel" select="//MenuItems/@CurrentLevel" />
  
  <xsl:template match="/">
    <div class="top-navigation">
      <xsl:apply-templates select="MenuItems" />
    </div>
  </xsl:template>

  <xsl:template match="MenuItems">
    <ul>
      <xsl:attribute name="class">
        <xsl:text>level0</xsl:text>
      </xsl:attribute>
      <xsl:apply-templates select="MenuItem" />
    </ul>
  </xsl:template>

  <xsl:template match="MenuItem">
    <li>
      <xsl:if test="@Selected = 'True'">
        <xsl:attribute name="class">active_navelement</xsl:attribute>
      </xsl:if>
      <xsl:if test="@Selected = 'False'">
        <xsl:attribute name="class">navelement</xsl:attribute>
      </xsl:if>
      <a>
        <xsl:attribute name="href">
          <xsl:value-of select="@Url" />
        </xsl:attribute>
        <xsl:if test="@Target!=''">
	        <xsl:attribute name="target">
	          <xsl:value-of select="@Target" />
	        </xsl:attribute>
        </xsl:if>
        <xsl:attribute name="title">
          <xsl:value-of select="@ToolTip" />
        </xsl:attribute>
        <xsl:value-of select="@Title" />
        <span>
          <xsl:attribute name="class">
            <xsl:text>hidden</xsl:text>
          </xsl:attribute>
          <xsl:value-of select="@ToolTip" />
        </span>
      </a>
    </li>
  </xsl:template>
</xsl:stylesheet>